﻿@{
    Bundle("jquery_validate");
    Bundle("ckeditor");
}
           
<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('@ID("#form")').validate({
            rules: {
                from: {
                    required: true
                },
                to: {
                    required: true
                },
                subject: {
                    required: true
                }
            }
        });
        jQuery('@ID("#txt_text")').ckeditor();
        jQuery.ajax({
            type: 'post',
            url: '@Url.Action(Loc.Act("Senders").Ctrl("Message"))',
            dataType: 'json',
            success: function (rsp) {
                jQuery('@ID("#ddl_sender")').empty();
                jQuery.each(rsp, function (k, v) {
                    jQuery('@ID("#ddl_sender")').append('<option value=' + v.id + '>' + v.value + '</option>');
                });
            }
        });
    });
</script>
<form id="@ID("form")" action="@Url.Action(Loc.Act("Create").Ctrl("Message"))" method="post">
    <input type="hidden" name="flags" value="None" />
    <table>
        <tr>
            <td>
                <label>@T(Res.Name("Sender"))</label>
            </td>
            <td>
                <select id="@ID("ddl_sender")" name="senderID"></select>
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("From"))</label>
            </td>
            <td>
                <input type="text" name="from" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("To"))</label>
            </td>
            <td>
                <input type="text" name="to" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("BccTo"))</label>
            </td>
            <td>
                <input type="text" name="bccTo" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("ReplyTo"))</label>
            </td>
            <td>
                <input type="text" name="replyTo" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("Subject"))</label>
            </td>
            <td>
                <input type="text" name="subject" maxlength="100" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("Text"))</label>
            </td>
            <td>
                <textarea id="@ID("txt_text")" name="text"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("MessageFlags").Name("Active"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="Active" checked />
            </td>
        </tr>
    </table>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>